Repository navigation
feat(labs): show a failed turn inline with its reason and Retry (FIX-2550) - #4738
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Second look + architecture pass (read-only; for the agent that picks this up)Overall: the approach is sound. Reusing the registry's 1.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 895241e77a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Simplify / review (FIX-2550)
Verdict: The shape of the change matches the approved spec and FIX-2370 — map engine error items to a failed entry, draw the registry request-recovery line, and expose adapter.retry → request(id).retry(). That is simpler and more correct than a third, lab-local failure markup (which the spec explicitly rejects). I am not approving yet because the two labs disagree on what “newest turn” means, and Claude Code-style can hide Retry in cases Teammates already handles.
What looks right (keep this approach)
- Thin screen, fat adapter: Retry stays behind
LabAdapter.retry;Entryonly receivesonRetrywhenlatest && !running. Matches D1 and keeps package calls out of components. - Registry reuse: Installed
request-recovery.tsxcopies are byte-identical topackages/ui/registry/components/request-recovery.tsx(verified). Wiring through existingErrorBodyis the intended FIX-2370 path. - Tests: Adapter cases + screen tests + one real-engine test per lab; I ran
vitestfor both labs’failed-turn*suites (all green).
Where complexity comes from (mostly unavoidable here)
| Chunk | ~lines | Simpler alternative? |
|---|---|---|
request-recovery.tsx ×2 |
292 | Spec says installed as-is; kitchen-sink uses the same vendoring model. Trimming interrupted/Continue UI would fork the registry file (not allowed). |
| Adapter + Entry + fake changes ×2 | ~200 | Two independent lab packages — some duplication is expected. |
| New tests ×2 | ~330 | See below — engine E2E is the main dedupe candidate. |
Main issue — align “newest turn” / latest (D2)
FIX-2550 D2: Retry follows what the person saw as the last turn; Teammates encodes this by tracking the last item that actually drew an entry (so a board pass that writes no line does not steal latest).
Claude Code-style uses newestTurn = items[items.length - 1]?.requestId when marking failed entries. Any later feed item with a different requestId clears latest, even when that item produces no thread entry — so Retry can disappear while the failure line is still the last thing the user cares about. Teammates’ adapter test “keeps Retry on a failed turn a later board pass wrote no entry for” pins the intended behavior; Claude has no analogous test.
Recommendation: Port Teammates’ two-pass newestTurn logic into entriesOf (or extract a tiny shared helper both adapters call). Add the board-pass (or equivalent “invisible tail item”) adapter test on the Claude side.
(I’m less sure how often Claude’s THREAD_ITEMS-filtered feed hits this in production vs Teammates; even so, one PR should not ship two different definitions of latest.)
Smaller simplify suggestions (optional / follow-up)
- Duplicate engine integration tests —
failed-turn-engine.test.tsis nearly the same in both labs. One copy (e.g. Teammates only) plus shared adapter unit tests would shrink ~60 lines without losing signal; keeping both is defensible for package isolation. - Registry drift — Kitchen Sink has
registry-drift.test.ts; labs rely on fallow + manual discipline. A thin drift check per lab (or shared script) would prevent silent skew from the registry — not required for FIX-2550, but it reduces long-term duplication cost. - Full
request-recoveryinstall — Continue/Discard paths are unused in these labs (fallow documents that). That weight is the cost of byte-identical install; no change suggested unless ER-4 later splits “failed-only” vs “interrupted” variants.
Performance
Nothing meaningful for lab thread sizes (extra Set over errors, optional trailing map in Teammates).
Happy to re-review after latest is aligned and Claude gains a regression test mirroring Teammates’ board-pass case.
Sent by Cursor Automation: Review For Best Approach
There was a problem hiding this comment.
Code Snob — already tight. No POC.
Read specs/issues/FIX-2550/SPEC.md, DECISIONS.md, both labs' adapter.ts, Entry.tsx, Claude Code-style Thread.tsx and the TasksPane / ThreadView Entry calls, Teammates Conversation.tsx, both request-recovery.tsx copies, both failed-turn.test.tsx, both failed-turn-engine.test.ts, both fake-lab.ts diffs, and .fallowrc.json. Seventeen files, +810/−18, on 895241e.
A rewrite does not shrink this contract:
- The two
request-recovery.tsxfiles are the spec's byte-identical install.INTERRUPTED_REASONis unused on the failed line, and.fallowrc.jsonignores the file the same way it ignoreserror.tsx. Cutting the export breaks the copy. One shared component breaks the lab install. - Teammates'
drawEntry, the length check, and the one.mapare D2: a board pass, a joined step, and asuspension_resumeadd no entry, so they are not the newest turn. Inlining the if-else that was already there drops the function keyword. Claude Code-style uses the last item'srequestIdbecause that feed has no silent pass. One helper for both labs would treat a Teammates board pass as the newest turn. retryOfinThread.tsxis one line so the closure gets astringafterrequestId !== undefined. Teammates inlines the call because a failed entry'srequestIdis required.- Adapter cases, screen cases, and the real-engine case are the spec's checks, once per lab. The engine files meet at different seams (
watchThread/createWiredLabvswatchConversation/createLabAdapter). - The task pane and
ThreadViewalready render<Entry>with noonRetry. That is E4. data-incompleteis unread. The visible Incomplete span is E2. Two attributes are not a smaller contract.
Left as recorded: D1 (adapter verb), D2 (newest from items), the registry copies, E1–E5. FIX-2558 and Kitchen Sink stay out of this PR.
Sent by Cursor Automation: Code Snob
…2550) Both labs map the engine's error item to a failed entry drawn by the registry's request-recovery, mark a reply its turn never finished incomplete, and offer Retry (the client's request(id).retry(), through a new adapter verb) on the newest turn only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDAAfKeTwqH2bFcZLD
…2550) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDAAfKeTwqH2bFcZLD
The engine refuses a retry of a request a task or the flow itself started (source internal/task), so a Retry on such a failed newest turn could only fail. The failed entry's `latest` becomes `retryable`: the newest turn and one of the session's recent requests from a source the engine re-enters (http, mcp, scheduled; a record with no source is http). Both labs pin their list to the engine's PUBLIC_REENTRY_SOURCES in a test. Claude Code-style reads the running turn and the retryable turns from one request listing, so a request notice is still one read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDAAfKeTwqH2bFcZLD
The newest turn was the last raw item's request, so an item that draws no entry (a retried notice, an empty message) of another turn hid Retry on the failed line. It is now the request of the last entry drawn, as in Teammates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDAAfKeTwqH2bFcZLD
20aaee5 to
5f6e8e6
Compare
|
Architect: not approving yet. Cursor's changes-requested review (at — FSD Architect |
|
This answers Cursor's changes-requested review (5776428981, on
Every inline thread is answered and resolved. Codex's latest review, on Generated by Claude Code |
…nto claude/project-thread-uim4cm # Conflicts: # labs/teammates/src/components/Entry.tsx
Head branch was pushed to by a user without write access
…-uim4cm # Conflicts: # labs/claude-code-style/src/components/Thread.tsx # labs/teammates/README.md
|
The failure is not from this PR. The PR does not touch Shift Manager, and the same two cases fail locally on plain Generated by Claude Code |


Requested by Jake · project thread
Implements FIX-2550 per its spec, #4725 (merged).
What it does
In the Claude Code-style and Teammates labs, a turn that fails now shows inline. The registry's
request-recoverydraws it: who failed ("The main session" or the worker's name), the engine's reason, and Retry. Retry appears only on the newest turn, only when the engine will retry that request, and never while a turn is running. A reply the failed turn never finished is marked Incomplete.erroritem to afailedentry and gainsretry(sessionId, requestId), which calls the client'srequest(id).retry()(spec D1).retryablewhen its request belongs to the newest turn that drew an entry and its source is one the engine re-enters: http, mcp or scheduled. A record with no source counts as http (spec D2). Each lab pins itsRETRYABLE_SOURCESto the engine'sPUBLIC_REENTRY_SOURCESin a test.errorto the item types its feed reads. It reads the running turn and the retryable turns from one request listing, so a request notice still costs one read.request-recovery.tsx..fallowrc.jsonignores the copies' unusedINTERRUPTED_REASON, as it does for the labs' other registry copies.retry, plusfailTurnandretriesfor the screen tests.Evidence
Each lab has two test files:
test/failed-turn.test.tsxcovers the adapter cases (built from anerroritem shaped the wayrunAction.tswrites it), the line, and the screen on the fake.test/failed-turn-engine.test.tsruns a real engine throughcreateInProcessFetch. Arespondthat throws once shows its reason through the adapter's feed, and the adapter'sretryruns it again as a second request that completes.Full suites are green: Claude Code-style 27 files / 183 tests, Teammates 28 / 193. Both labs typecheck, and eslint and
check-new-dead-codeare clean.Controls, each run red:
"error"branch from the adapter"error"from the thread's item typesNotes
it.failsagainst this issue. Whichever lands second removes the mark.apps/docschange.Generated by Claude Code